import Vue from 'vue'
import VueX from 'vuex'

Vue.use(VueX)

export default new VueX.Store({
	state: {
		isLogin: false,
		navigationBarTitleText: "行情",
		optional: ['sz002809','sz301560','sz301131','sz301076','sz003003','sz301396','sh603280','sz002165','sz301079','sz002861','bj838810','bj832469','sz002196']
	},
	getters: {

	},
	mutations: {
		setLogin(state,paload){
			state.isLogin = paload
		},
		setNavTitle(state,paload){
			state.navigationBarTitleText = paload
		},
		toggleOptional(state, code) {
			const index = state.optional.indexOf(code);
			if (index > -1) {
				state.optional.splice(index, 1);
				uni.showToast({
					title:'取消自选成功',
					duration:1000
				})
			} else {
				state.optional.push(code);
				uni.showToast({
					title:'添加自选成功',
					duration:1000
				})
			}
		}
	},
	actions: {

	}
})